<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta charset="UTF-8">
	<title></title>
	<link rel="stylesheet" href="css/bootstrap.min.css" />
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/bootstrap-dropdown.js"></script>
	<script type="text/javascript" src="js/bootstrap-alert.js"></script>
	<style type="text/css">
		body{
			margin-top:50px;
		}
		.page-header{
			background-color:rgb(240, 245, 248);
		}
		
	</style>
	
</head>
<body>
	<div class="navbar navbar-fixed-top">
	  <div class="navbar-inner">
		<div class="container">
			<a class="brand" href="#">
			  <img src="img/user_group.png" alt="" />&nbsp;客户关系管理系统
			</a>
			<ul class="nav">
			  <li>
				<a href="welcome.action">概览</a>
			  </li>
			  <li  class="active"><a href="contacts.action">通讯录</a></li>
			  <li><a href="tasks.action">任务</a></li>
			  <li><a href="chances.action">机会</a></li>
			  <li><a href="discuss.action">讨论</a></li>
			  <li class="dropdown" id="menutest1">
				<a class="dropdown-toggle" data-toggle="dropdown" href="#menutest1">
				  添加
				  <b class="caret"></b>
				</a>
				<ul class="dropdown-menu">
				  <li><a href="new_contact.action"><i class="icon-user"></i>&nbsp;联系人</a></li>
				  <li><a href="new_company.action"><i class="icon-home"></i>&nbsp;公司</a></li>
				  <li class="divider"></li>
				  <li><a href="new_task.action"><i class="icon-ok"></i>&nbsp;任务</a></li>
				  <li><a href="new_chance.action"><i class="icon-star-empty"></i>&nbsp;机会</a></li>
				</ul>
			  </li>
			  
			</ul>
			
			<ul class="nav pull-right" >
			  <li>
				<a href="#">${sessionScope.user.username }</a>
			  </li>
			  <li class="dropdown" id="menutest2">
				<a class="dropdown-toggle" data-toggle="dropdown" href="#menutest2">
				  管理
				  <b class="caret"></b>
				</a>
				<ul class="dropdown-menu">
				   <li><a href="manage_user.action?id=${sessionScope.user.id }"><i class="icon-user"></i>&nbsp;同事</a></li>
				  <li><a href="manage_group.action"><i class="icon-list-alt"></i>&nbsp;组</a></li>
				  <li class="divider"></li>
				<!--  <li><a href="user_update_user.action?id=${sessionScope.user.id }"><i class="icon-asterisk"></i>&nbsp;账号</a></li> -->
				  <li><a href="show_user_msg.action?id=${sessionScope.user.id }"><i class="icon-asterisk"></i>&nbsp;账号</a></li>
				</ul>
			  </li>
			  <li class="divider-vertical"></li>
			  <li><a href="sign_in.action">退出</a></li>
			</ul>
			
		</div>
	  </div>
	</div>
	
	<div class="container">
		
			<div class="row">
				  <div class="span2"></div>
				  <div class="span8">
					
						<div class="page-header well">
						  <h2><img src="img/contact_list.png" alt="" />&nbsp;${userGroup.groupname }组成员信息表</h2>
						</div>	
						
						<c:if test="${code == '10001' }">
								<div class="alert alert-info  fade in">
								<a class="close" data-dismiss="alert" href="#">&times;</a>
								 		该组暂无任何成员！！！
								</div>
							</c:if>
						
						<div class="page-header well">
							<table class="table">
							  <tbody>
									<c:choose>
										<c:when test="${sessionScope.user.id == '1'}">
											<tr >
									  			<td>姓名</td>
									  			<td>邮箱</td>
									  			<td>创建时间</td>
									  			<td>状态</td>
									  			<td>所在组类型</td>
									  			<td>修改账号信息</td>
							  				</tr>
							  			<c:forEach items="${userList }" var="user">
							  				
							  				<tr>
											  <td>
											  		<!-- <a href="user_msg.action?id=${user.id }">${user.username }</a> -->
											  		${user.username }
											</td>
											<td>
												${user.email }
											</td>
											<td>${user.createtime }</td>
											<td>${user.able }</td>
											<td>${user.userGroup.groupname }</td>
											<td><a href="admin_update_user.action?id=${user.id }">修改</a></td>
											</tr>
											
												</c:forEach>
										
										</c:when>
										
											<c:otherwise>
													
													<tr >
											  			<td>姓名</td>
											  			<td>邮箱</td>
											  			<td>创建时间</td>
											  			<td>状态</td>
											  			<td>所在组类型</td>
											  		</tr>
											  	<c:forEach items="${userList }" var="user">	
											<c:choose>
												<c:when test="${sessionScope.user.id == user.id }">
														<tr>
														  <td>
														  		<!-- <a href="user_msg.action?id=${user.id }">${user.username }</a> -->
														  		${user.username }
														</td>
														<td>
															${user.email }
														</td>
														<td>${user.createtime }</td>
														<td>${user.able }</td>
														<td>${user.userGroup.groupname }</td>
														<td><a href="user_update_user.action?id=${user.id }">修改密码</a></td>
														</tr>
												</c:when>
													<c:otherwise>
															<tr>
														  <td>
														  		<!-- <a href="user_msg.action?id=${user.id }">${user.username }</a> -->
														  		${user.username }
														</td>
														<td>
															${user.email }
														</td>
														<td>${user.createtime }</td>
														<td>${user.able }</td>
														<td>${user.userGroup.groupname }</td>
														</tr>
													</c:otherwise>
											</c:choose>
														
											</c:forEach>
													
											</c:otherwise>
									</c:choose>		
									
									
							  		
									

								
								
								
							
									
								<tr>
								
							  </tbody>
							</table>
							<div class="control-group">
			  <label class="control-label"></label>
			  <div class="controls">
				
				<button id="button1" class="btn btn-inverse" type="button">
				  返回
				</button>
				
			  </div> 
			</div>
						</div>	
						
						
				  </div>
				  
				  
				  
				  <div class="span4">
				  		
						  
						<div class="page-header well">
							<h3>公司内部管理</h3>
							<table class="table">
							  <tbody>
								<tr>
								  <td><img src="img/contacts.png" alt="" /><a href="manage_user.action?id=${sessionScope.user.id }">同事</a></td>
								</tr>
								<tr>
								  <td><img src="img/company.png" alt="" /><a href="manage_group.action">组</a></td>
								</tr>
								<tr>
								  <td><img src="img/company.png" alt="" /><a href="show_user_msg.action?id=${sessionScope.user.id }">账号</a></td>
								</tr>
								<tr>
								  <td><img src="img/company.png" alt="" /><a href="sign_in.action">安全退出</a></td>
								</tr>
							  </tbody>
							</table>
						</div>	
						
						
						
					  </div>
					</div>
			</div>
			
			
	
		</div>
		
	<script type="text/javascript">
		$(document).ready(function(){
			
			
			$(".alert").alert();
			
			$("#button1").click(function(){
				history.back();
			});
		
			$("#new_task").click(function(){
				$('#myModal').modal({
					backdrop:true,
					keyboard:true,
					show:false
				});
			});
		});
		
	</script>
</body>
</html>